<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="<%=path%>/css/manager/bbs_information2.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="<%=path%>/js/manager/jquery-1.8.2.js"></script>
<title>联系我们</title>
</head>
<body>
<form action="bbsbasicmanage.htm" id="sform" method="post">
  <input type="hidden" id="sysuserId" name="basUptuser" value="${back_user.sysuserId}"/>
  <input type="hidden" id="basContent" name="basContent" value="${basic.basContent}"/>
  <input type="hidden" id="markManage" name="markManage" value="${basic.markManage}"/>
  <input type="hidden" id="basId" name="basId" value="${basic.basId}"/>
  
</form>
	<!--
        	作者：offline
        	时间：2016-12-22
        	描述：论坛内容头部（统一，部分二级字体颜色单独修改）
        -->
		<div class="news_div1">
			<div class="news_div1_div1">论坛相关信息</div>
			<div class="news_div1_div2">
				<a href="###" class="news_div1_div2_div1 ablack">联系我们</a>
				<a>|</a>
				<a href="<%=path%>/basicctr/bbsrecruit.htm?markManage=2" class="news_div1_div2_div2">诚聘精英</a>
			</div>
		</div>
		<!--
        	作者：offline
        	时间：2016-12-24
        	描述：论坛相关信息
        -->
        <div class="bbs_tion2_div1">
        	<div class="bbs_div1_div1">
        		<span class="bbs_div1_div1_sp1">联系我们</span>
        	</div>
        	<div class="bbs_tion2_div1_div1">
        		<div class="bbs_tion2_div1_div1_div1">电话</div>
        		<input class="bbs_tion2_div1_div1_div1_in1" type="text" placeholder="请输入电话号码" id="tel" value="${map.tel}"/>
        	</div>
        	<div class="bbs_tion2_div1_div2">
        		<div class="bbs_tion2_div1_div1_div1">传真</div>
        		<input class="bbs_tion2_div1_div1_div1_in1" type="text" placeholder="请输入传真号码" id="fax" value="${map.fax}"/>
        	</div>
        	<div class="bbs_tion2_div1_div3">
        		<div class="bbs_tion2_div1_div1_div1">Email</div>
        		<input class="bbs_tion2_div1_div1_div1_in1" type="text" placeholder="请输入邮箱地址" id="email" value="${map.email}"/>
        	</div>
        	<div class="bbs_tion2_div1_div4">
        		<div class="bbs_tion2_div1_div1_div1">通讯地址</div>
        		<input class="bbs_tion2_div1_div1_div1_in1" type="text" placeholder="请输入通讯地址" id="address" value="${map.address}"/>
        	</div>
        	<div class="bbs_tion2_div1_div5">
        		<div class="bbs_tion2_div1_div1_div1">邮编</div>
        		<input class="bbs_tion2_div1_div1_div1_in1" type="text" placeholder="请输入邮编" id="code" value="${map.postcode}"/>
        	</div>
        	<div class="bbs_tion2_div1_div6">
        		<div class="bbs_tion2_div1_div1_div1">地图</div>
        		<div class="bbs_tion2_div1_div6_div2">
        			<input class="bbs_tion2_div1_div6_div2_in1" type="button" />
        			<input class="shangchuan_in" type="file" onchange="selectImagez(this);" id="" />
        			<p>1、图片尺寸为：每张图片不超过1024kb，仅支持jpg.jpeg.和png.格式；</p>
        			<p>2、图片要清晰，不能虚化。</p>
        			<img class="shangchuan_img" id="imagez" src="/upload/images/bbsmap/${map.mapimg}" />
        				<input type="hidden" name="mapimg" id="mapimg" value="${map.mapimg}"/>
        			 <input type="hidden" name="oldImg" id="oldImg" value="${map.mapimg}"
						disabled="disabled" />
        		</div>
        		<div class="clearBoth"></div>
        	</div>
        	<div class="bbs_tion2_div1_div7">
        		<input class="bbs_tion2_div1_div7_in1" type="button" onclick="submitCheck()"/>
        		<input class="bbs_tion2_div1_div7_in2" type="button" onclick="back()"/>
        	</div>
        </div>
</body>
<script type="text/javascript">
	//提交验证
	function submitCheck() {
		//验证管理员登录
		var sysuserId=$("#sysuserId").val();
		if(sysuserId.length==0){
			alert("管理员登录失效，请重新登录");
			window.open("<%=path%>/login/beforelogin.htm");
			return false;
		}
		//电话
		var tel = $.trim($("#tel").val());
		if (tel.length == 0) {
			alert("请输入联系电话！");
			$("#tel").focus();
			return false;
		} else{
			$("#tel").val(tel);
		}
		//传真
		var fax = $.trim($("#fax").val());
		if (fax.length == 0) {
			alert("请输传真号码！");
			$("#fax").focus();
			return false;
		} else{
			$("#fax").val(fax);
		}
		//邮箱
		var email = $.trim($("#email").val());
		var index1=/^([a-zA-Z0-9_\.\-]+)@([a-zA-Z0-9_\.\-]+)\.[c]{1}[o]{1}[m]{1}$/;
		if (email.length == 0) {
			alert("请输入联系邮箱！");
			$("#email").focus();
			return false;
		} else if(!index1.test(email)){
			alert("邮箱格式不正确！");
			$("#email").focus();
			return false;
		}else{
			$("#email").val(email);
		}
		//地址
		var address = $.trim($("#address").val());
		if (address.length == 0) {
			alert("请输入联系地址！");
			$("#address").focus();
			return false;
		} else{
			$("#address").val(address);
		}
		
		//邮编
		var postcode = $.trim($("#code").val());
		if (postcode.length == 0) {
			alert("请输入邮编号码！");
			$("#postcode").focus();
			return false;
		} else{
			$("#postcode").val(postcode);
		}
		
        //地图图片
		var mapimg=$("#mapimg").val();
        if(mapimg.length==0){
        	alert("请上传地图图片！");
			return false;
        }
        var content=tel+"@##"+fax+"@##"+email+"@##"+address+"@##"+postcode+"@##"+mapimg;
        $("#basContent").val(content);
		$("#sform").submit();
	}
	//返回事件
	function back() {
		window.location.href="<%=path%>/basicctr/bbscontact.htm?markManage=3";
	}
	//上传头像
	function selectImagez(file) {
		//控制显示oldImg路径
		$('#oldImg').attr("disabled",false); 
		if (!file.files || !file.files[0]) {
			return;
		}
		var image = '';
		var reader = new FileReader();
		reader.onload = function(evt) {
			document.getElementById('imagez').src = evt.target.result;
			image = evt.target.result;
			$.ajax({
				type : "post",
				url : '<%=path%>/imageController/updateImg.htm',
						data : {
							image : image,
							oldImg : file.id,
							path : "/upload/images/bbsmap/"
						},
						async : false,
						dataType : 'json',
						success : function(data) {
							$("#mapimg").val(data);
							$("#oldImg").val(data);
							file.id = data;
						},
						error : function(err) {
							alert('网络故障');
						}
					});
		}
		reader.readAsDataURL(file.files[0]);
		return false;
	}
</script>
</html>